//
//  P4994.cpp
//  Algorithm
//
//  Created by 刘锦程 on 2023/9/25.
//

#include <stdio.h>
#include<iostream>
using namespace std;
long long M;
long long fibn;
long long fiba[10000000];
int P4994ans(){
    cin>>M;
    fiba[0]=0;
    fiba[1]=1;
    for(int i=2;i<=M*M;i++){
        fiba[i]=(fiba[i-1]+fiba[i-2])%M;
        if(fiba[i-1]==0&&fiba[i]==1){
            cout<<i-1<<endl;
            break;
        }
    }
    return 0;
}
